home *** CD-ROM | disk | FTP | other *** search
- /* $VER: PowerCacheTest.rexx 37.2 (8.1.93)
- *
- * This script illustrates some of the features of PowerCache, and how
- * to use ARexx to control the program. Not all commands are tested. For
- * a complete description of PowerCache's ARexx interface, please refer
- * to PowerCacheARexx.guide.
- *
- * Copyright (C) 1993, 1994 by Michael Berg
- * All Rights Reserved
- */
-
- /* Make sure we get results back from ARexx */
- OPTIONS RESULTS
-
- /* Make sure PowerCache is on line */
- IF ~SHOW(P,'POWERCACHE') THEN DO
- SAY 'PowerCache is not running -- Start the program and run this script again'
- EXIT
- END
-
- /* Talk to him */
- ADDRESS 'POWERCACHE'
-
- /* Manifest constants */
- NL = '0a'x
- TAB = '09'x
-
- SAY '· Testing VERSION Command:' || NL
- Version
- SAY TAB || '· PowerCache returns "' || Result || '"'
- CALL PollReturn
-
- SAY '· Testing CACHEABLE Command:' || NL
-
- Cacheable STEM Result.
-
- SAY TAB || 'List of Cacheable devices:' NL
- DO i = 0 TO Result.device.count-1
- SAY TAB || i'.' Result.device.i Result.devname.i 'unit' Result.unit.i
- END
-
- CALL PollReturn
-
- SAY NL || '· Testing LISTCURRENTLYCACHED Command:' NL
- ListCurrentlyCached STEM Result.
-
- SAY TAB || 'Device' || TAB || 'Organization' || TAB || 'Type' || TAB || 'Algo' NL
-
- DO i = 0 TO Result.device.count-1
- SAY TAB || i'.' Result.device.i,
- ' '|| Result.sets.i Result.lines.i result.prefetch.i,
- TAB || Result.type.i,
- TAB || Result.algorithm.i
-
- /* Also available, but omitted for simplicity:
- *
- * Result.purgetime.i
- * Result.freeafterpurge.i
- * Result.cachebuffer.i
- * Result.buffersize.i
- * Result.overhead.i
- *
- * (Please refer to PowerCacheARexx.guide for an explanation of these
- * variables)
- */
- END
-
- CALL PollReturn
-
- /* We're going to use DF0: as an example in the following sections. So we
- * have to make sure the user is not already caching this device (and remove
- * it if he is)
- */
-
- GetCacheInfo 'DF0:'
-
- IF RC = 0 THEN DO
- RemoveCache 'DF0:'
- SAY NL || '(Removed Cache on DF0: to simplify the following ARexx example'||NL||'code sections)'
- CALL PollReturn
- END
-
- SAY '· Testing ADDCACHE Command' || NL
-
- AddCache 'DF0:' 8 32 4 'R/W' 'LRU' 2 'ANY' 'STATHOTKEY "shift control 0"'
-
- IF RC ~= 0 THEN DO
- SAY TAB || 'Could not add a 512k cache to DF0:' || NL,
- TAB || 'PowerCache says: "' || RC2 || '"'
- END
- ELSE DO
- SAY TAB || 'Successfully added a 8 x 32 x 4 cache (512k) to DF0:'
-
- CALL PollReturn
-
- SAY TAB || '· Testing GETCACHEINFO Command on DF0:' || NL
- GetCacheInfo 'DF0:' STEM Result.
- IF RC = 0 THEN DO
- SAY TAB || TAB || 'Sets =' Result.sets,
- NL || TAB || TAB || 'Lines =' Result.lines,
- NL || TAB || TAB || 'Prefetch =' Result.prefetch || NL,
- NL || TAB || TAB || 'Type =' Result.type,
- NL || TAB || TAB || 'Algorithm =' Result.algorithm,
- NL || TAB || TAB || 'Purgetime =' Result.purgetime,
- NL || TAB || TAB || 'FreePurge? ' Result.freeafterpurge,
- NL || TAB || TAB || 'StatHotKey =' Result.stathotkey || NL,
- NL || TAB || TAB || 'CacheBuffer =' Result.cachebuffer,
- NL || TAB || TAB || 'BufferSize =' Result.buffersize,
- NL || TAB || TAB || 'Overhead =' Result.overhead
- END
- ELSE SAY TAB || TAB || 'Could not GETCACHEINFO for DF0:' || NL,
- TAB || TAB || 'PowerCache says: "' || RC2 || '"'
-
- CALL PollReturn
-
- SAY '· Showing statistics for DF0: ...'
-
- ShowStats 'DF0:'
-
- IF RESULT == 'ON' THEN
- SAY TAB || 'Statistics window was already open' NL
- ELSE
- SAY TAB || 'Statistics window was opened' NL
-
- Call PollReturn
-
- SAY '· Closing the statistics window again...' NL
- HideStats 'DF0:'
-
- Call PollReturn
-
- SAY TAB || '· Testing REMOVECACHE Command'
- RemoveCache 'DF0:'
- IF RC ~= 0 THEN DO
- SAY TAB || TAB || 'Could not remove cache on DF0:' || NL,
- TAB || TAB || 'PowerCache says: "' || RC2 || '"'
- END
- ELSE SAY TAB || TAB || 'Successfully removed cache from DF0:'
- END
-
- CALL PollReturn
-
- SAY '· Testing GETDEVICEINFO Command for DF0:' || NL
-
- GetDeviceInfo 'DF0:' STEM Result.
- IF RC == 0 THEN DO
- SAY TAB || 'Logical Drive =' Result.logicaldrive || NL,
- TAB || 'Devicename =' Result.devicename || NL,
- TAB || 'Unit =' Result.unit || NL,
- TAB || 'Task TCB =' Result.tasktcb || NL,
- TAB || 'Sectorsize =' Result.sectorsize || NL,
- TAB || 'Surfaces =' Result.surfaces || NL,
- TAB || 'Blocks per Track =' Result.blockspertrack || NL,
- TAB || 'Capacity =' Result.capacity || NL,
- TAB || 'Reserved (start) =' Result.reservedstart || NL,
- TAB || 'Reserved (end) =' Result.reservedend || NL,
- TAB || 'Interleave =' Result.interleave || NL,
- TAB || 'Low Cylinder =' Result.lowcyl || NL,
- TAB || 'High Cylinder =' Result.highcyl || NL,
- TAB || 'Initial DOS Buffers =' Result.initialdosbuffers || NL,
- TAB || 'Buffer Memory Type =' Result.bufmemtype || NL,
- TAB || 'Max Transfer per Request =' Result.maxtransfer || NL,
- TAB || 'Address Mask =' Result.mask || NL,
- TAB || 'Boot Priority =' Result.bootpri || NL,
- TAB || 'File System =' Result.filesystem || NL,
- TAB || 'Boot Blocks =' Result.bootblocks || NL
- END
- ELSE SAY TAB || 'Could not GETDEVICEINFO for DF0:' || NL,
- TAB || 'PowerCache says: "' || RC2 || '"'
-
- CALL PollReturn
-
- SAY '· Testing SHOW/HIDE' || NL
- SAY TAB || '· SHOW'
- Show
- CALL PollReturn
- SAY TAB || '· HIDE'
- Hide
- CALL PollReturn
- Show
-
- SAY '· Testing SETENABLEKEY'
-
- SetEnableKey '"control shift alt b"'
- IF RC = 0 THEN DO
- SAY TAB || 'Managed to change the hotkey from "' || Result || '"' || NL,
- TAB || 'to "control shift alt b".'
-
- /* Double quoting is necessary - and this is how you do it */
- OldKey = '"' || Result || '"'
-
- CALL PollReturn
-
- SAY TAB || 'Restoring hotkey to original setting'
- SetEnableKey OldKey
-
- IF RC ~= 0 THEN SAY TAB || 'Failed -- PowerCache says: "' || RC2 || '"'
- END
- ELSE SAY TAB || 'Could not change hotkey' || NL,
- TAB || 'PowerCache says: "' || RC2 || '"'
-
- SAY NL || 'This concludes the demonstation. For a complete description' || NL,
- 'of the ARexx interface, please consult the ARexx guide in the' || NL,
- 'parent directory. You can close the window now if you like.'
-
- EXIT
-
- PollReturn:
- SAY NL || 'PRESS RETURN'
- PULL Anything
-